<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./iconfont/iconfont.css">
    <link rel="stylesheet" href="nav.css">
</head>

<body>
    <div class="Navigation">
        <ul>
            <li class="active">
                <a href="#">
                    <span class="iconfont icon-home"></span>
                    <span>Home</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <span class="iconfont icon-user"></span>
                    <span>Profile</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <span class="iconfont icon-comment"></span>
                    <span>Message</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <span class="iconfont icon-setting"></span>
                    <span>Setting</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <span class="iconfont icon-help"></span>
                    <span>Help</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <span class="iconfont icon-lock"></span>
                    <span>Password</span>
                </a>
            </li>
            <li>
                <a href="#">
                    <span class="iconfont icon-sign-out"></span>
                    <span class="title">Sign out</span>
                </a>
            </li>
        </ul>
    </div>
    <script>
        const list = document.querySelectorAll('li')
        console.log(list);
        function activeLink() {
            list.forEach((item) => {
                item.classList.remove('active')
                this.classList.add('active')
            })
        }
        list.forEach((item) => {
            item.addEventListener('click', activeLink)
        })
    </script>
</body>

</html>